package POJO;


import Utils.MD5Helper;


public class Agent {

//	static Logger logger = Logger.getLogger(Agent.class);
	
	private int id=-1;
	
	private String name;
	
	private String partnerId;
	
	private String password;
	
	private long timestamp;
	
	private String feedbackUrl;

	public int getId() {
		return id;
	}

	public String getName() {
		return name;
	}

	public String getPartnerId() {
		return partnerId;
	}

	public String getPassword() {
		return password;
	}

	public long getTimestamp() {
		return timestamp;
	}

	public void setId(int id) {
		this.id = id;
	}

	public void setName(String name) {
		this.name = name;
	}

	public void setPartnerId(String partnerId) {
		this.partnerId = partnerId;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public void setTimestamp(long timestamp) {
		this.timestamp = timestamp;
	}
	
	public String getFeedbackUrl() {
		return feedbackUrl;
	}

	public void setFeedbackUrl(String feedbackUrl) {
		this.feedbackUrl = feedbackUrl;
	}

	public boolean varify(String sign){
		//签 名：将用户标识、用户名、用户密码与当前时间戳连接成字符串，再将该字符串采用32位MD5大写加密后得到结果
		if(getSign(timestamp).equals(sign)){
			return true;
		}else{
			return false;
		}
	}
	
	public String getSign(long timestamp){
		String token=partnerId+name+password+timestamp;
		String s = MD5Helper.getMD5Str(token).toUpperCase();
//		logger.info("sign: " + s);
		return s;
	}
	
}
